package com.lzx.answer.controller.web;

import com.lzx.answer.entity.Browse;
import com.lzx.answer.service.BrowseService;
import com.lzx.common.utils.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/answer/browse/web")
public class WebBrowseController {
    @Resource
    private BrowseService browseService;

    //通过用户id获取用户浏览记录(提供给用户服务)
    @GetMapping("/getProblemBrowseListToUser/{userId}")
    public List<Browse> getProblemBrowseListToUser(@PathVariable Long userId) {
        return browseService.getProblemBrowseListToUser(userId);
    }

    //通过用户id获取用户浏览记录
    @GetMapping("/getBrowseProblem/{userId}")
    public R getBrowseProblem(@PathVariable Long userId) {
        return browseService.getBrowseProblem(userId);
    }

    //保存用户浏览问题记录
    @PostMapping("/saveUserBrowse")
    public R saveUserBrowse(@RequestBody Browse browse) {
        return browseService.saveUserBrowse(browse);
    }
}
